package ch03.factory.fstatic.dao;

import ch03.factory.fstatic.dao.impl.BlogMysqlDaoImpl;
import ch03.factory.fstatic.dao.impl.BlogOrclDaoImpl;
import ch03.factory.fstatic.dao.impl.BlogRedisDaoImpl;
import ch03.factory.fstatic.dao.BaseDao;
import ch03.factory.utils.Constanst;

/**
 * @author Jane
 * @date 2024-03-22 16:03
 */

public class BlogDaoFactory {
    public static BaseDao getInstance(String key){
        switch (key){
            case Constanst.DB_MYSQL:
                return new BlogMysqlDaoImpl();
                //break;
            case Constanst.DB_ORACLE:
                return new BlogOrclDaoImpl();
               // break;
            case Constanst.DB_REDIS:
                return new BlogRedisDaoImpl();
               // break;
            default:
                throw  new RuntimeException("未获取到有效的数据库实例"+key);
        }

    }
}
